package com.huiquan.analysis.dao;

import com.huiquan.analysis.domain.CheckDataSql;
import com.huiquan.framework.base.EnhancedBaseDao;
import com.ibatis.sqlmap.client.SqlMapClient;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * ClassName:Constants Description:
 *
 * @author ChaoKai Wen email:wenchaokai@gmail.com
 * @Date 14/9/22
 * @since Ver 1.0
 */
@Repository("checkDataDao")
public class CheckDataDao extends EnhancedBaseDao<CheckDataSql> {

    public CheckDataDao() {
        super(space);
    }

    @Resource(name = "sqlMapClient")
    private SqlMapClient sqlMapClient;

    public static final String space = "DATA_CHECK.";

    /**
     * 获取数据总数
     *
     * @return
     */
    public int checkSqlCount(Map<String, Object> param) {
        Integer size = (Integer) this.object(space + "CHECK_COUNT", param, sqlMapClient);
        return size == null ? 0 : size;
    }

    /**
     * 获取数据总数
     *
     * @return
     */
    public List<Map<String, Object>> checkSqlResult(Map<String, Object> param) {
        return (List<Map<String, Object>>) this.list(space + "CHECK_RESULT", param, sqlMapClient);

    }
}
